package com.bytedance.common.databinding;

import java.util.ArrayList;
import java.util.Collection;

public class ObservableArrayList extends ArrayList implements l {
    private transient c mListeners;

    public ObservableArrayList() {

        this.mListeners = new c();
    }

    public void add(int arg2, Object arg3) {
        super.add(arg2, arg3);
        this.notifyAdd(arg2, 1);
    }

    public boolean add(Object arg3) {
        super.add(arg3);
        this.notifyAdd(this.size() - 1, 1);
        return true;
    }

    public boolean addAll(int arg3, Collection arg4) {
        boolean v0 = super.addAll(arg3, arg4);
        if(v0) {
            this.notifyAdd(arg3, arg4.size());
        }

        return v0;
    }

    public boolean addAll(Collection arg4) {
        int v0 = this.size();
        boolean v1 = super.addAll(arg4);
        if(v1) {
            this.notifyAdd(v0, this.size() - v0);
        }

        return v1;
    }

    public void addOnListChangedCallback(a arg2) {
        if(this.mListeners == null) {
            this.mListeners = new c();
        }

        this.mListeners.a(arg2);
    }

    public void clear() {
        int v0 = this.size();
        super.clear();
        if(v0 != 0) {
            this.notifyRemove(0, v0);
        }
    }

    public int hashCode() {
        return System.identityHashCode(this);
    }

    private void notifyAdd(int arg4, int arg5) {
        if(this.mListeners != null) {
            this.mListeners.a(((l)this), 2, c.a());
        }
    }

    private void notifyRemove(int arg4, int arg5) {
        if(this.mListeners != null) {
            this.mListeners.a(((l)this), 4, c.a());
        }
    }

    public Object remove(int arg3) {
        Object v0 = super.remove(arg3);
        this.notifyRemove(arg3, 1);
        return v0;
    }

    public boolean remove(Object arg2) {
        boolean v0_1;
        int v0 = this.indexOf(arg2);
        if(v0 >= 0) {
            this.remove(v0);
            v0_1 = true;
        }
        else {
            v0_1 = false;
        }

        return v0_1;
    }

    public void removeOnListChangedCallback(a arg2) {
        if(this.mListeners != null) {
            this.mListeners.b(arg2);
        }
    }

    protected void removeRange(int arg2, int arg3) {
        super.removeRange(arg2, arg3);
        this.notifyRemove(arg2, arg3 - arg2);
    }

    public Object set(int arg5, Object arg6) {
        Object v0 = super.set(arg5, arg6);
        if(this.mListeners != null) {
            this.mListeners.a(((l)this), 1, c.a());
        }

        return v0;
    }
}

